﻿namespace FiftyOne.Foundation.Mobile.Detection.Wurfl.Handlers
{
    using FiftyOne.Foundation.Mobile.Detection.Wurfl;
    using System;

    internal class KDDIHandler : RegexSegmentHandler
    {
        private const string DEFAULT_DEVICE = "kddi_wap20_generic";
        private static readonly string PATTERN = @"KDDI-\w+";

        internal KDDIHandler() : base(PATTERN)
        {
        }

        protected internal override bool CanHandle(string userAgent)
        {
            return (userAgent.StartsWith("KDDI") && base.CanHandle(userAgent));
        }

        internal override DeviceInfo DefaultDevice
        {
            get
            {
                DeviceInfo deviceInfoFromID = Provider.Instance.GetDeviceInfoFromID("kddi_wap20_generic");
                if (deviceInfoFromID != null)
                {
                    return deviceInfoFromID;
                }
                return base.DefaultDevice;
            }
        }
    }
}

